#include <iostream>
#include <WinSock2.h>
#define MAX_IP_ADDRESS_LEN 16
#define MAX_PORT_LEN 6

int wait(SOCKET s, int seconds, int msec);

int TCP_recv(SOCKET s, char *buf, int maxsize, int wait_time)
{	
	int len = 0;
	if (wait(s,wait_time,0)>0 ) {
	
		len = recv(s, buf, maxsize, 0);
	}
	return len;
}